Skip to content

[Prism] Fix Reshuffle handling to recursively remove sub-transforms#38735

Merged
lostluck merged 1 commit into
apache:masterfrom
shunping:fix-reshuffle-handle
May 29, 2026
Merged

[Prism] Fix Reshuffle handling to recursively remove sub-transforms#38735
lostluck merged 1 commit into
apache:masterfrom
shunping:fix-reshuffle-handle

Conversation

@shunping
Copy link
Copy Markdown
Collaborator

@shunping shunping commented May 29, 2026

Updates handleReshuffle in the Go Prism runner to recursively clean up all nested sub-transforms of a Reshuffle composite transform using removeSubTransforms.

This prevents nested sub-transforms from being processed in subsequent graph optimization stages.

For example, prior to the change, we can see the following stage dump where stage-002, stage-003, stage-004 are from Reshuffle. They have -inf watermark and never have any bundle and stage-002 is connected to a dummy IMPULSE.

stage-000 watermark in +inf out +inf upstream +inf from IMPULSE   pending [] byKey map[] inprogressKeys map[] byBundle map[] holds [] holdCounts map[] holdsInBundle map[] pttEvents map[] bundlesToInject []
    sideInputs: [] outputCols: [ref_PCollection_PCollection_23] outputConsumers: [stage-001] sideConsumers: []
stage-001 watermark in +inf out +inf upstream +inf from stage-000 pending [] byKey map[] inprogressKeys map[] byBundle map[] holds [] holdCounts map[] holdsInBundle map[] pttEvents map[] bundlesToInject []
    sideInputs: [] outputCols: [ref_PCollection_PCollection_28] outputConsumers: [stage-008] sideConsumers: []
stage-002 watermark in -inf out -inf upstream -inf from IMPULSE   pending [] byKey map[] inprogressKeys map[] byBundle map[] holds [] holdCounts map[] holdsInBundle map[] pttEvents map[] bundlesToInject []
    sideInputs: [] outputCols: [ref_PCollection_PCollection_4] outputConsumers: [stage-003] sideConsumers: []
stage-003 watermark in -inf out -inf upstream -inf from stage-002 pending [] byKey map[] inprogressKeys map[] byBundle map[] holds [] holdCounts map[] holdsInBundle map[] pttEvents map[] bundlesToInject []
    sideInputs: [] outputCols: [ref_PCollection_PCollection_5] outputConsumers: [stage-004] sideConsumers: []
stage-004 watermark in -inf out -inf upstream -inf from stage-003 pending [] byKey map[] inprogressKeys map[] byBundle map[] holds [] holdCounts map[] holdsInBundle map[] pttEvents map[] bundlesToInject []
    sideInputs: [] outputCols: [] outputConsumers: [] sideConsumers: []
stage-005 watermark in +inf out +inf upstream +inf from IMPULSE   pending [] byKey map[] inprogressKeys map[] byBundle map[] holds [] holdCounts map[] holdsInBundle map[] pttEvents map[] bundlesToInject []
    sideInputs: [] outputCols: [ref_PCollection_PCollection_1] outputConsumers: [stage-006] sideConsumers: []
stage-006 watermark in +inf out +inf upstream +inf from stage-005 pending [] byKey map[] inprogressKeys map[] byBundle map[] holds [] holdCounts map[] holdsInBundle map[] pttEvents map[] bundlesToInject []
    sideInputs: [] outputCols: [ref_PCollection_PCollection_2] outputConsumers: [stage-007] sideConsumers: []
stage-007 watermark in +inf out +inf upstream +inf from stage-006 pending [] byKey map[] inprogressKeys map[] byBundle map[] holds [] holdCounts map[] holdsInBundle map[] pttEvents map[] bundlesToInject []
    sideInputs: [] outputCols: [ref_PCollection_PCollection_15] outputConsumers: [stage-009] sideConsumers: []
stage-008 watermark in +inf out +inf upstream +inf from stage-001 pending [] byKey map[] inprogressKeys map[] byBundle map[] holds [] holdCounts map[] holdsInBundle map[] pttEvents map[] bundlesToInject []
    sideInputs: [] outputCols: [fc_ref_PCollection_PCollection_28_to_ref_PCollection_PCollection_30] outputConsumers: [stage-014] sideConsumers: []
stage-009 watermark in +inf out +inf upstream +inf from stage-007 pending [] byKey map[] inprogressKeys map[] byBundle map[] holds [] holdCounts map[] holdsInBundle map[] pttEvents map[] bundlesToInject []
    sideInputs: [] outputCols: [fc_ref_PCollection_PCollection_15_to_ref_PCollection_PCollection_16] outputConsumers: [stage-010] sideConsumers: []
stage-010 watermark in +inf out +inf upstream +inf from stage-009 pending [] byKey map[] inprogressKeys map[] byBundle map[] holds [] holdCounts map[] holdsInBundle map[] pttEvents map[] bundlesToInject []
    sideInputs: [] outputCols: [ref_PCollection_PCollection_16] outputConsumers: [stage-011] sideConsumers: []
stage-011 watermark in +inf out +inf upstream +inf from stage-010 pending [] byKey map[] inprogressKeys map[] byBundle map[] holds [] holdCounts map[] holdsInBundle map[] pttEvents map[] bundlesToInject []
    sideInputs: [] outputCols: [ref_PCollection_PCollection_17] outputConsumers: [stage-012] sideConsumers: []
stage-012 watermark in +inf out +inf upstream +inf from stage-011 pending [] byKey map[] inprogressKeys map[] byBundle map[] holds [] holdCounts map[] holdsInBundle map[] pttEvents map[] bundlesToInject []
    sideInputs: [] outputCols: [ref_PCollection_PCollection_29] outputConsumers: [stage-013] sideConsumers: []
stage-013 watermark in +inf out +inf upstream +inf from stage-012 pending [] byKey map[] inprogressKeys map[] byBundle map[] holds [] holdCounts map[] holdsInBundle map[] pttEvents map[] bundlesToInject []
    sideInputs: [] outputCols: [fc_ref_PCollection_PCollection_29_to_ref_PCollection_PCollection_30] outputConsumers: [stage-014] sideConsumers: []
stage-014 watermark in +inf out +inf upstream +inf from stage-008 pending [] byKey map[] inprogressKeys map[] byBundle map[] holds [] holdCounts map[] holdsInBundle map[] pttEvents map[] bundlesToInject []
    sideInputs: [] outputCols: [ref_PCollection_PCollection_30] outputConsumers: [stage-015] sideConsumers: []
stage-015 watermark in +inf out +inf upstream +inf from stage-014 pending [] byKey map[] inprogressKeys map[] byBundle map[] holds [] holdCounts map[] holdsInBundle map[] pttEvents map[] bundlesToInject []
    sideInputs: [] outputCols: [ref_PCollection_PCollection_31] outputConsumers: [stage-016] sideConsumers: []
stage-016 watermark in +inf out +inf upstream +inf from stage-015 pending [] byKey map[] inprogressKeys map[] byBundle map[] holds [] holdCounts map[] holdsInBundle map[] pttEvents map[] bundlesToInject []
    sideInputs: [] outputCols: [] outputConsumers: [] sideConsumers: []
)

…sforms

Updates `handleReshuffle` in the Go Prism runner to recursively clean up all
nested sub-transforms of a Reshuffle composite transform using
`removeSubTransforms`. This prevents nested sub-transforms from being
processed in subsequent graph optimization stages.
@shunping shunping marked this pull request as ready for review May 29, 2026 02:41
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request improves the Go Prism runner's handling of Reshuffle composite transforms. By ensuring that all nested sub-transforms are recursively removed during the handling process, the runner avoids issues where stale or orphaned transforms interfere with later stages of the pipeline graph optimization.

Highlights

  • Recursive Sub-transform Removal: Updated the handleReshuffle function in the Go Prism runner to utilize removeSubTransforms for recursive cleanup of nested sub-transforms.
  • Improved Graph Optimization: Ensures that nested sub-transforms are properly removed, preventing them from being incorrectly processed in subsequent graph optimization stages.
  • Added Regression Testing: Introduced a new test case in handlerunner_test.go to verify that handleReshuffle correctly identifies and removes nested sub-transforms.
New Features

🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the Prism runner's reshuffle handler to recursively remove all sub-transforms by calling removeSubTransforms instead of only removing the top-level sub-transforms. Additionally, a new unit test TestHandleReshuffle is added to verify this recursive removal and the correct remapping of consumer inputs. No review comments were provided, and there is no additional feedback.

@shunping
Copy link
Copy Markdown
Collaborator Author

r: @lostluck

@github-actions
Copy link
Copy Markdown
Contributor

Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control. If you'd like to restart, comment assign set of reviewers

@lostluck lostluck merged commit c31f232 into apache:master May 29, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants